//
//  model.cpp
//  OpenLearn
//
//  Created by korion chen on 2020/3/18.
//  Copyright © 2020 korion. All rights reserved.
//

#include <stdio.h>
#include "header/model.h"
#define STB_IMAGE_IMPLEMENTATION
#include "stb_image.h"

bool ImageData::loadData(bool reverseY){
    stbi_set_flip_vertically_on_load(reverseY);
    data = stbi_load(path, &width, &height, &nrChannels, 0);
    if (data == NULL){
        return false;
    }
    return true;
}

ImageData::~ImageData(){
    if (data != NULL){
        stbi_image_free(data);
        data = NULL;
    }
    path = NULL;
}
